package com.situ.scientific.service.impl;

import com.situ.scientific.dao.IResearchersDao;
import com.situ.scientific.dao.impl.ResearchersDaoImpl;
import com.situ.scientific.pojo.Researchers;
import com.situ.scientific.pojo.query.ResearchersQuery;
import com.situ.scientific.pojo.vo.ResearchIdVo;
import com.situ.scientific.pojo.vo.ResearchersVo;
import com.situ.scientific.service.IResearchersService;
import com.situ.scientific.util.PageRusult;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

public class ResearchersServiceImpl implements IResearchersService {
    IResearchersDao researchersDao = new ResearchersDaoImpl();
    @Override
    public PageRusult selectByPage(ResearchersQuery researchersQuery) {
        //1.查询totalCount
        int totalCount = researchersDao.totalCount(researchersQuery);//不需要传参
        //2.查询当前页的信息
        List<ResearchersVo> list = researchersDao.selectByPage(researchersQuery);
        //3.返回信息
        PageRusult<ResearchersVo> pageRusult = new PageRusult<>(0,"",totalCount,list);
        System.out.println(pageRusult);
        return pageRusult;
    }

    @Override
    public int deleteById(int id) {
        return 0;
    }

    @Override
    public void importExcel(HttpServletRequest req) {

    }

    @Override
    public List<Researchers> selectAll() {
        return null;
    }

    @Override
    public void deleteAll(String[] ids) {

    }

    @Override
    public void update(Researchers researchers) {

    }

    @Override
    public void add(Researchers researchers) {
        researchersDao.add(researchers);
    }

    @Override
    public Researchers login(String name, String password) {
        return researchersDao.login(name,password);
    }

    @Override
    public ResearchIdVo selectById(String id) {
        return researchersDao.selectById(id);
    }
}
